/*
        Firesoft 
        
    Copyright (C) 2010, Arttu Viljakainen 
    Published under GNU General Public License V3 
    (see http://www.gnu.org/licenses/licenses.html)
    
    This file is part of Firesoft.

    Firesoft is free software: 
    you can redistribute it and/or modify it under the terms of the GNU General 
    Public License as published by the Free Software Foundation, 
    either version 3 of the License, or (at your option) any later version.

    Firesoft is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
    Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Tool for Path Finding Algorithm Testing. If not, see         
    <http://www.gnu.org/licenses/>.
 */
package softstarter.gui.subareas.controlbuttons;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import softstarter.gui.subareas.ButtonFactory;


public class ControlButtons {

	private ControlButtonsController controller;
	private ControlButtonsListener listener;
	
	private JPanel masterContainer;
	
	private JButton showFiles;
	private JButton exit;
	private JButton hide;
	
	private ButtonFactory buttonFactory;
	
	public ControlButtons(ControlButtonsController controller) {
		this.controller = controller;
	    buttonFactory = new ButtonFactory();
		build();
	}
	
	private void build() {
		masterContainer = new JPanel();
		masterContainer.setOpaque(false);
		FlowLayout layout = new FlowLayout();		
		layout.setHgap(10);
		layout.setVgap(0);
		masterContainer.setLayout(layout);
		masterContainer.setBorder(new EmptyBorder(0, 0,0, 0));
		
		listener = new ControlButtonsListener(controller);
		
		showFiles = buttonFactory.getNewIconButton("Files", "/images/SettingsButton.png", "Show settings");
		exit = buttonFactory.getNewIconButton("Exit", "/images/PowerButton.png", "Quit");
        hide = buttonFactory.getNewIconButton("Hide", "/images/MinimizeButton.png", "Minimize");
		
	    showFiles.addActionListener(listener);
		exit.addActionListener(listener);
		hide.addActionListener(listener);
		
		masterContainer.add(showFiles);
		masterContainer.add(hide);
		masterContainer.add(exit);
	}
		
	public JPanel getMasterContainer() {
		return masterContainer;
	}

	public ControlButtonsListener getListener() {
	    return listener;
	}

}
